#include <iostream>
#include <set>
#include <utility>

#include "Chromosome.h"
#include "Population.h"
#include "GeneticOptimizer.h"
#include "Selection.h"
#include "CrossoverOperator.h"
#include "MutationOperator.h"
#include <cstdlib>
#include <ctime>
#include <sstream>
#include "Helper.h"

#include "F1.h"
#include "F4.h"
#include "F6.h"



int main (int argc, char * const argv[]) {
	// Required
	srand(time(NULL));
	    
	// Operators
	KTournamentSelection ktso;
	OnePointCrossoverOperator opco(15);
	UniformCrossoverOperator uco;
	ProbabilityMutationOperator pmo(0.01);
	
	//Function
	F1 f6;
	
	std::vector<double> p(3);
	p[0] = 1; p[1] = 2; p[2] = 3;
	F4 f4(p);
	
	// Minimizer
	// (function, selection method, crossover operator, mutation operator)
	GeneticOptimizer gm(f6, ktso, uco, pmo);
	
	// Must be initialized!
	// (500 iterations, true if minimization, precision of 5 decimals)
	gm.Initialize(500, true, 5);
	
	// Optimize (number of iterations)!
	std::vector<double> d = gm.Optimize(1000);
	
	// Tell us result :)
	std::cout << "Result: " << printVector(d) << std::endl;
	
    return 0;
}